﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using PlanningGIS.Framework;
using PlanningGIS.ManageUtility;
using PlanningGIS.Util.Security;
using PlanningGIS.Win.Controls;

namespace PlanningGIS.Entry
{
    /// <summary>
    /// 
    /// </summary>
    public partial class FrmReLogin : Office2007Form
    {
        /// <summary>
        /// 
        /// </summary>
        public FrmReLogin()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtPSD.Text)) return;
            if (FrameworkHelper.CurrentUser == null)
            {
                MsgHelper.ShowErrorMsgbox("登录信息为空");
                return;
            }
            if (FrameworkHelper.CurrentUser.PSD.Equals(SecurityHelper.EnCryptUnidirectional(txtPSD.Text.Trim(), AppConfig.SystemConfig.基本信息.密钥)))
            {
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            else
            {
                MsgHelper.ShowErrorMsgbox("密码不正确");
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExit_Click(object sender, EventArgs e)
        {
            if (MsgHelper.ShowYesOrNoQueryMsgBox("是否确定要退出该系统？", this) != System.Windows.Forms.DialogResult.Yes) return;
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }



    }
}
